<template>
    <div class="blindGiftHime" style="color: white; font-size: 16px;">
        <div >
            <!--  <el-button @click="test" type="primary">测试按钮</el-button> -->
           
            <div  class="blindGiftHimeTitle">
                {{ labelStr }}
            </div>
            <div v-if="nowUser.isZhuan">
                <span style="color: gold;">
                    {{ nowUser.userName }}
                </span>
                <span style="color: gold;">
                    这次多薅了{{ nowUser.price  }}元
                </span>
            </div>
            <div v-else>
                <span style="color: red;">
                    {{ nowUser.userName }}
                </span>
                <span style="color: black;">
                    这次多送了{{ Math.abs(nowUser.price)  }}元
                </span>
            </div>
           
            <div v-if="nowUser.finalPrice>=0">
                <span  style="color: red;">
                    {{ nowUser.userName }}
                </span>
                <span  style="color: black;">
                    一共多薅了{{ Math.abs(nowUser.finalPrice) }}元
                </span>
            </div>
            <div v-else>
                <span  style="color: red;">
                    {{ nowUser.userName }}
                </span>
                <span  style="color: black;">
                    一共多送了{{ Math.abs(nowUser.finalPrice) }}元
                </span>
            </div>
            <div >
                <span v-if="total>=0" style="color: gold;">
                    本直播间一共多赚了{{Math.abs(total)}}元
                </span>
                <span v-else style="color: black;">
                    本直播间一共多送了{{Math.abs(total)}}元
                </span>
            </div>
            <div >
                欧皇榜:
                <span  style="color: gold;">
                    {{ lucky.userName }}
                </span>(
                    <span  style="color: gold;">
                        {{ lucky.finalPrice }}元
                    </span>)
                </div>
            <div >
                非酋榜:
                  <span  style="color: black;">
                      {{ unlucky.userName }}
                  </span>(
                    <span  style="color: black;">
                        {{ unlucky.finalPrice }}元
                    </span>)
            </div>
        </div>
    </div>
   
</template>
<script>
import ChatClientDirectWeb from '@/api/chat/ChatClientDirectWeb'
export default {
  name: 'GiftCount',
  props: {
    roomKeyValue: {
      type: [Number, String],
      default: null
    },
  },
  data() {
    return {
      count: 0,
      chatClient: null,
      labelStr: '【温心盲盒姬提醒您】',
      nowUser: {
        userName: '无',
        price: 0,
        uid: null,
        isZhuan: true,
        finalPrice: 0.0 // 最终价格
      }, // 当前这次送礼人是谁
      defaultStr: '无', // 默认5无
      lucky: {
        userName: '无',
        price: 0,
        uid: null,
        finalPrice: 0.0 // 最终价格
      }, // 欧皇榜
      unlucky: {
        userName: '无',
        price: 0,
        uid: null,
        finalPrice: 0.0, // 最终价格
        face: null// 头像
      }, // 非酋榜
      total: 0.0, // 总共赚/亏 多少钱
      isLose: false, // 是否赚 false:赚 ，true:不赚
      temp: {
        userName: '无',
        price: 0,
        uid: null,
        isZhuan: true,
        finalPrice: 0.0, // 最终价格
        face: null// 头像
      }, // 中间临时数据
      nowUserMap: null, //
      luckyMap: null, // 所有欧皇map
      unluckyMap: null, // 所有非酋map
      nowUserList: [],
      luckyList: [], // 所有欧皇数组
      unluckyList: [], // 所有非酋数组
      testJsonList: [
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"bdea3fa8-7a38-400a-b2b3-fec5bff71c41","batch_combo_send":{"action":"投喂","batch_combo_id":"bdea3fa8-7a38-400a-b2b3-fec5bff71c41","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":14000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"逝雪"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"5f2d81ef-6d19-4510-921b-8a7c2a1040c4","combo_num":1,"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":16000,"crit_prob":0,"demarcation":2,"discount_price":16000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":33877,"giftName":"神奇金杯","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":16000,"rcost":9159165,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841370731074048","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841370731074048","timestamp":1711167612,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"0db940e2-a6d5-4e95-9525-137b2d48574c","batch_combo_send":{"action":"投喂","batch_combo_id":"0db940e2-a6d5-4e95-9525-137b2d48574c","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":9000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":32126,"gift_name":"棉花糖","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":9000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"89bf8e73-5468-41be-b9b9-623766dad834","combo_num":1,"gift_id":32126,"gift_name":"棉花糖","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":9000,"crit_prob":0,"demarcation":2,"discount_price":9000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":32126,"giftName":"棉花糖","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":9000,"rcost":9159095,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841347532364800","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841347532364800","timestamp":1711167606,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"bdea3fa8-7a38-400a-b2b3-fec5bff71c41","batch_combo_send":{"action":"投喂","batch_combo_id":"bdea3fa8-7a38-400a-b2b3-fec5bff71c41","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"5f2d81ef-6d19-4510-921b-8a7c2a1040c4","combo_num":1,"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":16000,"crit_prob":0,"demarcation":2,"discount_price":16000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":33877,"giftName":"神奇金杯","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":16000,"rcost":9159165,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841370731074048","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841370731074048","timestamp":1711167612,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"0db940e2-a6d5-4e95-9525-137b2d48574c","batch_combo_send":{"action":"投喂","batch_combo_id":"0db940e2-a6d5-4e95-9525-137b2d48574c","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":9000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":32126,"gift_name":"棉花糖","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":9000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"89bf8e73-5468-41be-b9b9-623766dad834","combo_num":1,"gift_id":32126,"gift_name":"棉花糖","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":9000,"crit_prob":0,"demarcation":2,"discount_price":9000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":32126,"giftName":"棉花糖","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":9000,"rcost":9159095,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841347532364800","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841347532364800","timestamp":1711167606,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"fead68a2-ece8-44ba-9036-efd702d51536","batch_combo_send":{"action":"投喂","batch_combo_id":"fead68a2-ece8-44ba-9036-efd702d51536","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"d1f6f3d3-8dde-40f2-999d-599ce68d9a80","combo_num":1,"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":16000,"crit_prob":0,"demarcation":2,"discount_price":16000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":33877,"giftName":"神奇金杯","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":16000,"rcost":9159165,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841364615865856","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841364615865856","timestamp":1711167610,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"c43b3758-f53d-4eba-9fd8-db8422da34c5","batch_combo_send":{"action":"投喂","batch_combo_id":"c43b3758-f53d-4eba-9fd8-db8422da34c5","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":9000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":32126,"gift_name":"棉花糖","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":9000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"c19aadc2-32a6-4a50-a009-eff07ca37fc7","combo_num":1,"gift_id":32126,"gift_name":"棉花糖","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":9000,"crit_prob":0,"demarcation":2,"discount_price":9000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":32126,"giftName":"棉花糖","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":9000,"rcost":9159095,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841340620195328","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841340620195328","timestamp":1711167605,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"bc68b732-870f-4b1b-bf3c-f4becc36cb0c","batch_combo_send":{"action":"投喂","batch_combo_id":"bc68b732-870f-4b1b-bf3c-f4becc36cb0c","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":16000,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":15000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"7a159b20-325a-494f-a0dd-3826b2a946f8","combo_num":1,"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":16000,"crit_prob":0,"demarcation":2,"discount_price":16000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":33877,"giftName":"神奇金杯","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":16000,"rcost":9159165,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841334207117312","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841334207117312","timestamp":1711167603,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"bc68b732-870f-4b1b-bf3c-f4becc36cb0c","batch_combo_send":{"action":"投喂","batch_combo_id":"bc68b732-870f-4b1b-bf3c-f4becc36cb0c","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":5200,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":5000},"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":5200,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":5000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"7a159b20-325a-494f-a0dd-3826b2a946f8","combo_num":1,"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"Miyyooo"},"combo_stay_time":5,"combo_total_coin":16000,"crit_prob":0,"demarcation":2,"discount_price":16000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":33877,"giftName":"神奇金杯","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":16000,"rcost":9159165,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841334207117312","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"Miyyooo","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"Miyyooo"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841334207117312","timestamp":1711167603,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"Miyyooo","wealth_level":54}',
        '{"action":"投喂","bag_gift":null,"batch_combo_id":"bc68b732-870f-4b1b-bf3c-f4becc36cb0c","batch_combo_send":{"action":"投喂","batch_combo_id":"bc68b732-870f-4b1b-bf3c-f4becc36cb0c","batch_combo_num":1,"blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":5200,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":5000},"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"test1"},"beatId":"","biz_source":"live","blind_gift":{"blind_gift_config_id":51,"from":0,"gift_action":"爆出","gift_tip_price":5200,"original_gift_id":32251,"original_gift_name":"心动盲盒","original_gift_price":5000},"broadcast_id":0,"coin_type":"gold","combo_resources_id":1,"combo_send":{"action":"投喂","combo_id":"7a159b20-325a-494f-a0dd-3826b2a946f8","combo_num":1,"gift_id":33877,"gift_name":"神奇金杯","gift_num":1,"send_master":null,"uid":3493089012353967,"uname":"test1"},"combo_stay_time":5,"combo_total_coin":16000,"crit_prob":0,"demarcation":2,"discount_price":16000,"dmscore":1512,"draw":0,"effect":0,"effect_block":0,"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","face_effect_id":0,"face_effect_type":0,"float_sc_resource_id":0,"giftId":33877,"giftName":"神奇金杯","giftType":0,"gift_tag":[],"gold":0,"group_medal":null,"guard_level":2,"is_first":true,"is_join_receiver":true,"is_naming":false,"is_special_batch":0,"magnification":1,"medal_info":{"anchor_roomid":0,"anchor_uname":"","guard_level":0,"icon_id":0,"is_lighted":0,"medal_color":0,"medal_color_border":0,"medal_color_end":0,"medal_color_start":0,"medal_level":0,"medal_name":"","special":"","target_id":0},"name_color":"#E17AFF","num":1,"original_gift_name":"","price":16000,"rcost":9159165,"receive_user_info":{"uid":3546577291446858,"uname":"漫听-阚卿"},"receiver_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","is_mystery":false,"name":"漫听-阚卿","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/f9516d8625bfe7829c500f8b2eaa7c1805bd6a94.jpg","name":"漫听-阚卿"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3546577291446858,"wealth":null},"remain":0,"rnd":"4488841334207117312","send_master":null,"sender_uinfo":{"base":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","is_mystery":false,"name":"test1","name_color":0,"name_color_str":"","official_info":{"desc":"","role":0,"title":"","type":-1},"origin_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"test1"},"risk_ctrl_info":{"face":"https://i0.hdslb.com/bfs/face/7309629379c24813c382a90e767a8e2d4adb24d3.jpg","name":"test1"}},"guard":null,"guard_leader":null,"medal":null,"title":null,"uhead_frame":null,"uid":3493089012353967,"wealth":null},"silver":0,"super":0,"super_batch_gift_num":1,"super_gift_num":1,"svga_block":0,"switch":true,"tag_image":"","tid":"4488841334207117312","timestamp":1711167603,"top_list":null,"total_coin":15000,"uid":3493089012353967,"uname":"test1","wealth_level":54}'

      ]
    }
  },
  beforeDestroy() {
    if (this.chatClient) {
      this.chatClient.stop()
    }
  },
  methods: {
    test() {
      const randomIndex = Math.floor(Math.random() * this.testJsonList.length) // 生成随机索引
      let tesjson = this.testJsonList[randomIndex]
      // let tesjson = this.testJsonList[this.count++]
      this.onAddGift(tesjson)
    },
    init() {
      this.nowUserMap = new Map()
      this.unluckyMap = new Map()
      this.luckyMap = new Map()
    },
    initClient() {
      this.chatClient = new ChatClientDirectWeb(this.roomKeyValue)

      // this.chatClient = new ChatClientDirectOpenLive('CGBQ6J0MWZ5S7')
      
      this.chatClient.onAddText = this.onAddText
      this.chatClient.onAddGift = this.onAddGift
      this.chatClient.start()
    },
    onAddGift(dataJson) {
      console.log(dataJson)
      console.log(dataJson.super_gift_num)
      let num = dataJson.super_gift_num
      if (dataJson.blind_gift && dataJson.batch_combo_send) {
        let face = dataJson.receiver_uinfo.base.face
        let sendUser = dataJson.batch_combo_send
        let blindGift = sendUser.blind_gift
        let userName = sendUser.uname
        let uid = sendUser.uid
        // console.log('用户信息', sendUser, '礼物信息', blindGift)
        // 中间价
        let price = ((blindGift.gift_tip_price - blindGift.original_gift_price) * num / 1000).toFixed(1)
        this.total = (parseFloat(this.total) + parseFloat(price)).toFixed(1)
        // 是否赚了
        let isZhuan
        // 当前用户的总共赚/亏的价格
        let finalPrice = price

        let tempUser
        if (this.nowUserMap && this.nowUserMap.has(userName)) {
          tempUser = this.nowUserMap.get(userName)
          if (tempUser.userName == userName) {
            finalPrice = (parseFloat(tempUser.finalPrice) + parseFloat(price)).toFixed(1)
            // tempUser.finalPrice = finalPrice
            // console.log('finalPrice', finalPrice)
          }
        }
        this.nowUser.userName = userName
        this.nowUser.price = price
        this.nowUser.uid = uid
        this.nowUser.finalPrice = finalPrice
        this.nowUser.face = face

        let tempUser2 = {
          userName,
          price,
          uid,
          finalPrice,
          face
        }
        this.nowUserMap.set(userName, tempUser2)
        // console.log('this.nowUserMap', this.nowUserMap)
        // 欧皇榜
        if (blindGift.gift_tip_price >= blindGift.original_gift_price) {
          isZhuan = true
          this.nowUser.isZhuan = isZhuan
          console.log('用户', userName, '赚了', price)
          let tempUserLuck = {
            userName,
            price,
            uid,
            finalPrice,
            face
          }
          if (finalPrice > 0) {
            this.luckyMap.set(userName, tempUserLuck)
          } else {
            this.unluckyMap.set(userName, tempUserLuck)
          }
          this.luckyList = [...this.luckyMap.values()]
          this.luckyList.sort((a, b) => b.finalPrice - a.finalPrice)
          this.lucky = this.luckyList[0]
          // console.log('欧皇榜', this.luckyList)
          this.unluckyList = [...this.unluckyMap.values()]
          this.unluckyList.sort((a, b) => a.finalPrice - b.finalPrice)
          if (this.lucky) {
            if (this.lucky.userName == this.unlucky.userName && finalPrice > 0) {
              // console.log('欧皇榜换人')
              this.unlucky.userName = '无'
              this.unlucky.finalPrice = 0.0
            // this.lucky.finalPrice = finalPrice
            } else if (this.lucky.userName == this.unlucky.userName && finalPrice < 0) {
              finalPrice = (parseFloat(this.lucky.finalPrice) + parseFloat(this.unlucky.finalPrice)).toFixed(1)
              this.lucky.userName = '无'
              this.lucky.finalPrice = 0.0
              this.lucky.finalPrice = finalPrice
              this.lucky.face = face
            }
            if (finalPrice < 0) {
              this.unlucky = this.unluckyList[0]
            }
          } else {
            this.lucky = {
              userName: '无',
              finalPrice: 0.0
            }
            this.unlucky = this.unluckyList[0]
          }
        } else { // 非酋榜
          isZhuan = false
          this.nowUser.isZhuan = isZhuan
          console.log('用户', userName, '亏了', price)
          let tempUserUnLuck = {
            userName,
            price,
            uid,
            finalPrice
          }
          if (finalPrice < 0) {
            this.unluckyMap.set(userName, tempUserUnLuck)
          } else {
            this.luckyMap.set(userName, tempUserUnLuck)
          }
          this.unluckyList = [...this.unluckyMap.values()]
          this.unluckyList.sort((a, b) => a.finalPrice - b.finalPrice)
          this.unlucky = this.unluckyList[0]
          if (this.unlucky) {
            if (this.lucky.userName == this.unlucky.userName && finalPrice < 0) {
              // console.log('非酋榜换人')
              this.lucky.userName = '无'
              this.lucky.finalPrice = 0.0
            // this.unlucky.finalPrice = finalPrice
            } else if (this.lucky.userName == this.unlucky.userName && finalPrice > 0) {
              finalPrice = (parseFloat(this.lucky.finalPrice) + parseFloat(this.unlucky.finalPrice)).toFixed(1)
              this.unlucky.userName = '无'
              this.unlucky.finalPrice = 0.0
              this.unlucky.finalPrice = finalPrice
            }
          } else {
            this.unlucky = {
              userName: '无',
              finalPrice: 0.0
            }
            this.luckyList = [...this.luckyMap.values()]
            this.luckyList.sort((a, b) => b.finalPrice - a.finalPrice)
            this.lucky = this.luckyList[0]
          }
        }
        

      }
    },
    async onAddText(data) {
      console.log(data.authorName, '说', data.content)
    }
  },
  mounted() {
    this.initClient()
    this.init()
  }
}


</script>
<style scoped>
.blindGiftHimeTitle {
    color: #000;
    text-shadow: -1px 1px 0 white, 1px 1px 0 white, 1px -1px 0 white, -1px -1px 0 white;
}
.blindGiftHime {
    color: #000;
    text-shadow: 0.1em 0.1em 0.2em black;
    /* border-left:thick double #ff0000; */
}
</style>
